package com.alex.statistics.pojo.result.structureanalysis;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.List;

/**
 * 静态结构分析结果
 */
@Data
public class StaticStructureResult {

    // 占比分析结果（内部类）
    @Data
    @Schema(description = "占比分析结果")
    public static class ProportionResult {
        @Schema(description = "计算耗时（毫秒）")
        private long computeTime;

        @Schema(description = "整体总值")
        private Double totalValue;

        @Schema(description = "各组成部分的占比详情")
        private List<ProportionDetail> details;

        @Data
        @AllArgsConstructor
        public static class ProportionDetail {
            @Schema(description = "组成部分名称")
            private String componentName;

            @Schema(description = "组成部分数值")
            private Double value;

            @Schema(description = "占比（百分比）")
            private Double proportion;
        }
    }

    // 构成比分析结果（内部类）
    @Data
    @Schema(description = "构成比分析结果")
    public static class CompositionRatioResult {
        @Schema(description = "计算耗时（毫秒）")
        private long computeTime;

        @Schema(description = "总合计值")
        private Double totalValue;

        @Schema(description = "各分类的构成比详情")
        private List<CompositionDetail> details;

        @Data
        @AllArgsConstructor
        public static class CompositionDetail {
            @Schema(description = "分类名称")
            private String categoryName;

            @Schema(description = "分类数值")
            private Double value;

            @Schema(description = "构成比（百分比）")
            private Double ratio;
        }
    }

    // 帕累托分析结果（内部类）
    @Data
    @Schema(description = "帕累托分析结果")
    public static class ParetoResult {
        @Schema(description = "计算耗时（毫秒）")
        private long computeTime;

        @Schema(description = "总影响值")
        private Double totalImpact;

        @Schema(description = "关键因素累计占比阈值（百分比）")
        private Double threshold;

        @Schema(description = "按影响值降序排列的因素详情")
        private List<ParetoDetail> sortedFactors;

        @Schema(description = "关键因素名称（累计占比达到阈值的前N项）")
        private List<String> keyFactors;

        @Data
        @AllArgsConstructor
        public static class ParetoDetail {
            @Schema(description = "因素名称")
            private String factorName;

            @Schema(description = "影响值")
            private Double impactValue;

            @Schema(description = "占比（单个因素占总值的百分比）")
            private Double proportion;

            @Schema(description = "累计占比（百分比）")
            private Double cumulativeProportion;
        }
    }
}
    